package com.zhuiyun.pm.client.interest.controller;

import com.zhuiyun.pm.client.interest.entity.ClientInterest;
import com.zhuiyun.pm.client.interest.service.ClientInterestService;
import com.zhuiyun.pm.config.CommonResult;
import com.zhuiyun.pm.page.PageRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;


@RestController
@CrossOrigin
@RequestMapping("/clientInterest")
public class ClientInterestController {
    //注入
    @Autowired
    private ClientInterestService ClientInterestServiceImpl;

    /**
     *被关注用户详情
     * @author 温
     * @date 2023/3/23 14:31
     * @parameter [id]
     * @return com.zhuiyun.pm.config.CommonResult
     */
    @GetMapping("/clientInterestList")
    public CommonResult clientInterestList( @RequestParam int userId,@RequestParam int uuId){
        ClientInterest clientInterest = ClientInterestServiceImpl.clientInterestList(userId,uuId);
        return CommonResult.ok(clientInterest);
    }

    /**
     * 点击关注添加一条数据
     * @author 温
     * @date 2023/3/23 14:32
     * @parameter [clientInterest]
     * @return com.zhuiyun.pm.config.CommonResult
     */
    @PostMapping("/clientIntegerAdd")
    public CommonResult clientIntegerAdd(@RequestBody ClientInterest clientInterest){
        int i = ClientInterestServiceImpl.clientInterestAdd(clientInterest);
        return CommonResult.ok(i);
    }
    /**
     * 取消关注删除一条数据
     * @author 温
     * @date 2023/3/23 14:32
     * @parameter [id]
     * @return com.zhuiyun.pm.config.CommonResult
     */
    @GetMapping("/clientDel")
    public CommonResult clientDel(@RequestParam int userId,@RequestParam int uuId){
        int i = ClientInterestServiceImpl.clientInterestDel( userId, uuId);
        return CommonResult.ok(i);
    }
    /**
     * 查询粉丝数量
     * @author 温
     * @date 2023/3/23 19:12
     * @parameter
     * @return
     */
    @GetMapping("/clientFen")
    public CommonResult clientFen(@RequestParam int uuId){
        Integer sum = ClientInterestServiceImpl.clientInterest(uuId);
        return CommonResult.ok(sum);
    }
}
